package com.scap.authen.service;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang.RandomStringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.BindingResult;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.support.RequestContextUtils;

import com.scap.authen.dao.SiteDao;
import com.scap.authen.dao.UserLoginDao;
import com.scap.authen.dao.UserMappingDao;
import com.scap.authen.entity.Application;
import com.scap.authen.entity.UserLogin;
import com.scap.authen.entity.UserMapping;
import com.scap.authen.util.Encryption;
import com.scap.authen.util.JDate;
import com.scap.authen.util.ValidateField;

@Service("userMappingService")
@Transactional
public class UserMappingServiceImpl implements UserMappingService {

	@Autowired
	private UserMappingDao voUserMappingDao;
	@Autowired
	private ApplicationContext context;
	@Override
	public List<Object> getAllUserMapping() {
		// TODO Auto-generated method stub
		return null;
	}
	@Override
	public String getUserMappingByUserId(String vaUserId) {
		String vaUserMapping = "";
		List<UserMapping> voObjectList = voUserMappingDao.getUserMappingByUserId(vaUserId);
		for(UserMapping voUserMapping : voObjectList){
			if(vaUserMapping.equals("")){
				vaUserMapping += voUserMapping.getVaSiteId()+"|"+voUserMapping.getVaRoleId();
			}else{
				vaUserMapping += ","+voUserMapping.getVaSiteId()+"|"+voUserMapping.getVaRoleId();
			}
		}
		
		return vaUserMapping;
	}
	@Override
	public String insertUserLogin(UserLogin voUserLogin,
			String vaSiteAndRoleId, BindingResult result,
			HttpServletRequest request) {
		// TODO Auto-generated method stub
		return null;
	}
	@Override
	public String updateUserLogin(UserLogin voUserLogin,
			String vaSiteAndRoleId, BindingResult result,
			HttpServletRequest request) {
		// TODO Auto-generated method stub
		return null;
	}
	@Override
	public String deleteUserLogin(UserLogin voUserLogin,
			HttpServletRequest request) {
		// TODO Auto-generated method stub
		return null;
	}

	

}
